//||=========================================================================||
//||                                                                         ||
//||                            TemplateMakers.h                             ||
//||                                                                         ||
//||                           by the_best_goose))                           ||
//||                                                                         ||
//||=========================================================================||

#ifndef COUNTERMAKER_H_
#define COUNTERMAKER_H_

#include "IMandelbrotCounter.h"

//-----------------------------------------------------------------------------

class MainWindow;
typedef IMandelbrotCounter* (*CounterMaker)(const MainWindow* pwind,
		                                    const QWidget* pwgt);
typedef QWidget* (*MandelbrotWgtMaker)(const MainWindow* pwind);

//-----------------------------------------------------------------------------

template<class MandCounter>
IMandelbrotCounter* MakeCounter(const MainWindow* pwind, const QWidget* pwgt)
{
    return new MandCounter(pwind, pwgt);
}

//-----------------------------------------------------------------------------

template<class MandWgt, class MandPic, class Counter>
QWidget* MakeMandelbrotWgt(const MainWindow* pwind)
{
    return new MandWgt(new MandPic(MakeCounter<Counter>, pwind), pwind);
}

//-----------------------------------------------------------------------------

#endif // COUNTERMAKER_H_
